package org.sky.service.serviceImpl;

import org.sky.base.DaoSupport;
import org.sky.model.Booking;
import org.sky.service.BookingService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.persistence.Query;
import java.util.Date;
import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * User: Administrator
 * Date: 12-10-21
 * Time: 下午8:35
 * To change this template use File | Settings | File Templates.
 */

@Service
@Transactional
public class BookingServiceImpl extends DaoSupport<Booking> implements BookingService {

    @Override
    public List<Booking> findBookingByCreateDate(Date begin, Date end) {

        Query query = em.createQuery("from Booking b where b.createDate > ?1 and b.createDate < ?2");
        query.setParameter(1,begin).setParameter(2,end);
        System.out.println(query.toString());
        return query.getResultList();
    }
}
